package Modelo;

import java.sql.ResultSet;
import java.sql.SQLException;

public class Reportes {
	
	public String getReporte1() //ordenadas por cantidad ascendente;
	{
		String rep=""; 
		String sql="select *from \"vistaVentas\" order by \"Cantidad\" ";
        Conexion bd = new Conexion();
        ResultSet rs = bd.consulta(sql);
		try {
			while (rs.next())
			{
			 rep+=rs.getInt(1) + "  "+ rs.getString(2) + "  " + rs.getInt(3) + "  " + rs.getFloat(4) + "\n";			
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return rep;
		
	}
	
	public String getReporte2() //ordenadas por cantidad descendente;
	{
		String rep=""; 
		String sql="select *from \"vistaVentas\" order by \"Cantidad\" desc";
        Conexion bd = new Conexion();
        ResultSet rs = bd.consulta(sql);
		try {
			while (rs.next())
			{
			 rep+=rs.getInt(1) + "  "+ rs.getString(2) + "  " + rs.getInt(3) + "  " + rs.getFloat(4) + "\n";			
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return rep;
		
	}
	public String getReporte3() //ordenadas por Monto ascendente;
	{
		String rep=""; 
		String sql="select *from \"vistaVentas\" order by \"Monto\" ";
        Conexion bd = new Conexion();
        ResultSet rs = bd.consulta(sql);
		try {
			while (rs.next())
			{
			 rep+=rs.getInt(1) + "  "+ rs.getString(2) + "  " + rs.getInt(3) + "  " + rs.getFloat(4) + "\n";			
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return rep;
		
	}
	
	public String getReporte4() //ordenadas por monto descendente;
	{
		String rep=""; 
		String sql="select *from \"vistaVentas\" order by \"Monto\" desc";
        Conexion bd = new Conexion();
        ResultSet rs = bd.consulta(sql);
		try {
			while (rs.next())
			{
			 rep+=rs.getInt(1) + "  "+ rs.getString(2) + "  " + rs.getInt(3) + "  " + rs.getFloat(4) + "\n";			
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return rep;
		
	}

	public String getReporte5() //Cantidades disponibles;
	{
		String rep=""; 
		String sql="select *from \"Ingredientes\" ";
        Conexion bd = new Conexion();
        ResultSet rs = bd.consulta(sql);
		try {
			while (rs.next())
			{
			 rep+=rs.getInt(1) + "  "+ rs.getString(2) + "  " + rs.getDouble(3) + "\n";			
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return rep;
		
	}

	public String getReporte6() //Ingredientes mas Usados Ascendente;
	{
		String rep=""; 
		String sql="select *from \"usados\" order by \"Cantidad\" ";
        Conexion bd = new Conexion();
        ResultSet rs = bd.consulta(sql);
		try {
			while (rs.next())
			{
			 rep+=rs.getString(1) + "  "+ rs.getDouble(2) + "  " + rs.getString(3) +  "  " + rs.getString(4) + "\n";			
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return rep;
		
	}

	public String getReporte7() //Ingredientes mas Usados Descendente;
	{
		String rep=""; 
		String sql="select *from \"usados\" order by \"Cantidad\" desc";
        Conexion bd = new Conexion();
        ResultSet rs = bd.consulta(sql);
		try {
			while (rs.next())
			{
			 rep+=rs.getString(1) + "  "+ rs.getDouble(2) + "  " + rs.getString(3) +  "  " + rs.getString(4) + "\n";			
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return rep;
		
	}

}
